package com.pasabahceambalaj.session;

import com.pasabahceambalaj.entity.*;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;
import java.util.Arrays;

@Name("malzemeList")
public class MalzemeList extends EntityQuery<Malzeme> {

	private static final String EJBQL = "select malzeme from Malzeme malzeme";

	private static final String[] RESTRICTIONS = { "lower(malzeme.ad) like lower(concat(#{malzemeList.malzeme.ad},'%'))", "lower(malzeme.barkod) like lower(concat(#{malzemeList.malzeme.barkod},'%'))", "lower(malzeme.kod) like lower(concat(#{malzemeList.malzeme.kod},'%'))", };

	private Malzeme malzeme = new Malzeme();

	public MalzemeList() {
		setEjbql(EJBQL);
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
		setMaxResults(25);
	}

	public Malzeme getMalzeme() {
		return malzeme;
	}
}
